package cn.smile.commons.response;

/**
 * <p>
 * API 统一返回状态码
 * </p>
 *
 * @author 龙逸
 * @since 2020-08-20
 */
@SuppressWarnings("SpellCheckingInspection")
public enum MyResponseCode {

    /**
     * 未知错误
     */
    UNKNOWN(-1, "未知错误,请联系管理员"),

    /**
     * 请求成功
     */
    SUCCESS(0, "成功"),
    // ------------------------------------------------------- 客户端错误：4000-4999 Start
    NOT_FOUND(4004, "资源未找到"),
    UNDEFINED(4005, "请求参数格式错误"),
    REQ_METHOD_ERROR(4006, "请求方法错误"),
    USER_NOT_LOGGED_IN(4101, "用户未登录"),
    USERNAME_OR_PASSWORD_ERROR(4102, "用户名或密码错误"),
    USER_DISABLED_ERROR(4103, "用户已禁用"),
    LOGIN_ERROR(4104, "登陆异常"),
    BAN_IP_ACCESS(4105, "限制访问, 请联系管理员"),
    USER_NOT_FOUNT(4106, "用户未找到"),
    SUSPEND_VISIT_IP_ERROR(4107, "限制登录用户, 请20分钟后重试"),
    // ------------------------------------------------------- 客户端错误：4000-4999 End

    // ------------------------------------------------------- 服务端错误：5000-5999 Start
    /**
     * 数据未找到
     */
    SYSTEM_ERROR(5000, "系统错误, 请联系管理员"),
    RESULT_DATA_NONE(5001, "数据不存在"),
    FILE_NULL(5002, "上传文件为空"),
    NO_PERMISSION(5100, "权限认证未通过"),
    NULL_MAIL_CONTENT(5201, "消息内容获取失败"),
    DATA_EXIST_ERROR(5202, "数据已存在"),
    ROLE_CODE_EXIST_ERROR(5203, "角色编码已存在"),
    URI_ROLE_EXIST_ERROR(5205, "资源URI已存在"),
    EMAIL_FORMAT_ERROR(5206, "邮箱格式错误"),
    REGIST_USER_ERROR(5207, "注册次数过多, 请稍后再试"),
    LOGIN_ID_EXIST_ERROR(5208, "登录名已存在"),
    RESET_PWD_ERROR(5209, "重置密码次数过多, 请稍后再试"),
    USER_DATA_NONE(5210, "用户不存在, 请检查后重试"),
    UNBOUNDED_EMAIL_NONE(5211, "未绑定邮箱, 请联系管理员"),
    GET_ACCESS_TOKEN_ERROR(5212, "获取微信 sessionKey 失败"),
    ENTITY_TO_XML_ERROR(5213, "对象转换 XML 字符串失败"),
    DECODING_USER_INFO_ERROR(5214, "解码微信用户信息异常"),
    PREDEFINED_CLASSIFY_UPDATE_ERROR(5215, "预置分类不可修改"),
    PREDEFINED_CLASSIFY_DELETE_ERROR(5215, "预置分类不可删除"),
    FILE_UPLOAD_ERROR(5217, "上传文件失败"),
    FILE_NAME_ERROR(5218, "上传文件名称为空"),
    EXPORT_FILE_EMAIL_ERROR(5219, "接收文件邮箱为空, 不可导出"),
    GET_WE_CHAT_TOKEN(5220, "获取微信 accessToken 失败"),
    MQTT_CONNECT_ERROR(5221, "创建 MQTT 连接失败"),
    QR_CODE_TIME_OUT(5222, "扫码超时,请刷新二维码重试"),
    QR_CODE_DOWNLOAD_ERROR(5223, "微信小程序二维码下载失败"),
    GET_MINI_PROJECT_TOKEN(5223, "获取小程序 accessToken 失败"),
    MI_ROUTER_TOKEN_ERROR(5224, "获取小米路由器 Token 失败"),
    MAC_ADD_EXIST_ERROR(5225, "MAC 地址已存在"),
    ERROR_MIN_IO_BUCKET(5226, "MinIO 文件存储异常"),
    ERROR_RTSP_CAMERA_VIDEO(5227, "摄像头 RTSP 视频异常"),
    ERROR_RTSP_CAMERA_VIDEO_TO_JPEG(5228, "RTSP 视频流转 JPEG 图片异常"),
    LOGIN_ID_INCONFORMITY_RULE(5229, "登录名不符合规则"),
    EMAIL_INCONFORMITY_RULE(5230, "邮箱不符合规则"),
    LOGIN_ID_EXIST(5231, "登录账号已存在"),
    LOGIN_ID_UNMATCHING_ERROR(5232, "登录账号不匹配, 请刷新后重试"),
    USER_NOT_EXIST(5233, "用户不存在"),
    ROLE_CODE_INCONFORMITY_RULE(5234, "角色代码不符合规则"),
    DELETE_SYSTEM_RESOURCES_ERROR(5235, "系统资源不可删除"),
    NOT_FOUND_MODEL_FILE_ERROR(5236, "未找到模型文件"),
    FACE_DETECT_ERROR(5237, "人脸识别异常"),
    FILE_CONVERSION_ERROR(5238, "文件转换异常"),
    COUNT_DATE_ERROR(5239, "计算时间异常"),
    PHONE_EXIST_ERROR(5208, "登陆号已存在"),
    WISH_STUTAS_ERROR(5209, "状态已变更, 不可再次变更"),
    PHONE_NO_EXIST_ERROR(5210, "手机号不存在, 请先邀请用户注册"),
    EXIST_LOVERS_ERROR(5211, "存在待确或已确定情侣关系, 不可绑定"),
    OLD_PASSWORD_ERROR(5212, "原密码错误, 不可修改"),
    CONFIRM_PASSWORD_ERROR(5213, "新密码与确认密码不一致"),
    NO_CHANGE_PASSWORD_ERROR(5214, "新密码与旧密码一致"),
    STRING_TO_DATETIME_ERROR(5215, "字符串转时间异常"),
    SHOP_CODE_DATA_NONE(5216, "店铺编码不存在"),
    SHOP_UN_INIT_ERROR(5217, "未绑定店铺或未初始化"),
    USER_ID_NULL_ERROR(5218, "解绑用户ID为空"),
    MEMBER_NO_EXIST_ERROR(5219, "会员编号已存在"),
    MEMBER_ID_NULL_ERROR(5220, "会员ID为空"),
    MEMBER_BALANCE_NOT_NULL_ERROR(5221, "会员余额未清空"),
    ITEM_ID_NOT_NULL_ERROR(5222, "项目ID为空"),
    MEMBER_UN_ENABLE_ERROR(5223, "非启用会员, 不可操作"),
    INSUFFICIENT_BALANCE_ERROR(5224, "账户余额不足"),
    PREDEFINED_ITEM_UPDATE_ERROR(5225, "预置项目不可修改"),
    PREDEFINED_ITEM_DELETE_ERROR(5226, "预置项目不可删除"),
    NONMEMBER_ERROR(5227, "非会员不可使用折扣"),
    TOP_UP_ID_NULL_ERROR(5228, "充值记录ID为空"),
    EXPENSE_ID_NULL_ERROR(5229, "消费记录ID为空"),
    INSUFFICIENT_GIFT_BALANCE_ERROR(5230, "赠送余额不足"),
    VOUCHER_DATE_ERROR(5231, "代金券有效期有误"),
    VOUCHER_STATUS_ERROR(5232, "代金券非可用状态"),
    BUSINESS_ERROR(5999, "自定义业务错误"),
    PREDEFINED_ROLE_ERROR(5204, "预置角色不可删除");
    // ------------------------------------------------------- 服务端错误：5000-5999 End

    private final Integer code;

    private final String message;

    MyResponseCode(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer code() {
        return this.code;
    }

    public String message() {
        return this.message;
    }

    @Override
    public String toString() {
        return this.name();
    }
}
